import Vue from 'vue'
import Router from 'vue-router'
import Login from '@/components/Login'
import L404 from '@/components/404'
import Index from '@/components/Index'

Vue.use(Router)

export default new Router({
  routes: [
    {
      path: '/login',
      name: 'login',
      component: Login
    },{
      path: '/',//首页
      name: 'index',
      component: Index,
      redirect: '/index',//默认子路由
      meta: {
        requireAuth: true,  // 添加该字段，表示进入这个路由是需要登录的
      },
      children: [
        {
          path: '/index',
          component: Index,
          meta: {
            requireAuth: true,
          },
        }
      ]
    },{
      path: '*',
      component: L404
    }
  ]
})
